{{extend './common/layout.html'}}
{{block 'link'}}
	<link rel="stylesheet" href="/home/css/index.css">
{{/block}}
{{block 'main'}}
	<!-- 头部框架开始 -->
	{{include './common/header.html'}}
	<!-- 头部框架结束 -->
	<!-- 文章列表开始 -->
	<ul class="list w1100">
		{{each result.records}}
		<li class="{{$index%2 == 0?'fl':'fr'}}">
			<a href="article?id={{@$value._id}}" class="thumbnail">
				<img src="{{$value.cover}}.jpg">
			</a>
			<div class="content">
				<a class="article-title" href="article?id={{@$value._id}}">{{$value.title}}</a>
				<div class="article-info">
					<span class="author">{{$value.author.username}}</span>
					<span>{{dataformat($value.publishDate)}}</span>
				</div>
				<div class="brief">
					<!-- 替换html标签 -->
					<!-- 截取150个字符 -->
					<!-- @原文输出就不会有&nbsp; -->
					{{@$value.content.replace(/<[^>]+>/g,'').substr(0,150) + '...'}}
				</div>
			</div>
		</li>
		{{/each}}
	
	</ul>
	<!-- 文章列表结束 -->

	<!-- 分页开始 -->
	<div class="page w1100">
		{{if result.page > 1}}
		<a href="/home/?page={{result.page-1}}" >上一页</a>
		{{/if}}
		{{each result.display}}
		<a href="/home/?page={{$value}}" class="{{$value==result.page?'active':''}}">{{$value}}</a>
		{{/each}}
		{{if result.page < result.pages}}
		<a href="/home/?page={{result.page-0+1}}">下一页</a>
		{{/if}}
	</div>
	<!-- 分页结束 -->
{{/block}}
